Basic Syntax



Flex-Able is not unlike other scripts in that is has three basic components; Commands, Variables, and Arguments.

An explanation of the color coding system:

How it works:

The built-in Commands are listed in the commands pages. These are the actions you actually perform with the scripts you build. Every Flex-Able command is in an angle-bracketed HTML-type tag, but proceeded by a colon. Flex-Able acts upon all the '<:' tags in a file with the extension '.able'. Here's an example of two commands- 'date', which simply returns the system's date to whatever is calling it, and 'echo', which puts it's arguments into a stream. (The 'stream' is out-going data; it can be an email message, a file you are saving, or a response page for a processed form. Wherever the data is flowing in that particular part of your script, echo will send it's arguments).
<:echo <:date>>
Variables are created by you. These are containers for data of varied and often multiple types. For example, when you read a form with form_read the data goes into a container of type form_read with a name you choose. The variable you've created contains all the data from the form.

Arguments are the datum you actually perform the actions upon. For example, when you say
<:do_this toThis>, the 'toThis' portion is the argument. As often as not, the argument is actually a variable that you created earlier- but in those cases the Argument is left blue to more easily keep track of it though the commands list.

Here's a generic example of how a Flex-Able script might be built. Start with gathering your data. It could be coming in with the URL that opens the .able page, or it's form data that uses your .able page as an action.
You need to collect your data into a data structure that Flex-Able can process, typically in a conveniently named variable. This is done with the set command.

<:set myVar<:TypeOfAction>>
as in
<:set myForm<:form_read>>
You might also just want to create a variable that has regular text- or even a variable that points to a file on your system. This can be done even more easily:
<:set myString "This is the string in myString" >
In the myString example, you explicitly put the data into the variable. If you were reading it in from a form, you would simply read it in with form_read- the result is the same. You now have a variable that you may then perform actions upon. For example, you might want to encode your new string into a URL friendly string to pass it somewhere else. Now that you have it contained in a variable, you can say
<:url_encode myString>
It can be done just as easily with
<:url_encode "This is the string in myString">
..but then you are limited to a single string. With the variable, you can perform the action on a variable that contains a whole set of form data- as in 'myForm'.

Sometimes, you will want to perform actions upon specific pieces of data in one of your variables. In the 'myForm' example above, the variable myForm contains all the field names and values for the entire form. If you want to do something with a particular field, you can. The variable you've created is actually an array- that means every piece, or even specific groups of them (if you're careful), can be accessed. This is done with the square-bracket notation. For example, you've just read in a form with several fields, but you just want to do something with the one named 'email'. The HTML looks like <input type=text name=email>. If you want to echo this email address somewhere, you would use the following:

<:echo myForm["email"]>

All the Flex-Able commands take different arguments; you will need to consult the commands list for descriptions of the requirements and operations of each one in order to implement them. Reading the Syntax By Example page will give you an idea of how it all fits together.


back to Contents /